<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 *  Statistics Controller
 *
 * @package XGO CMS v2.0
 * @subpackage configuration
 * @author Manh Nguyen - 08/08/2012
 * @link http://sunsoft.vn
*/
class Statistics extends CI_Controller {

	/**
	 * Contrust class
	 *
	 * @access public
	 */
	public function __construct() {
		parent::__construct();

		$this->load->library('smarty3', '', 'smarty');
		$this->load->helper('file');
		$this->load->helper('array');
		require_once(APPPATH . 'modules/backend/autoload.php');
		
		$this->load->library('login_manager');
		require_once(APPPATH . 'modules/backend/info.php');
		
		$this->load->language('button');

		$this->login_manager->check_role('configuration');
		$this->load->language('backend');
		$this->smarty->assign('language', $this->lang);
		$this->smarty->assign('message', $this->session->flashdata('message'));
		$this->smarty->assign('error_message', $this->session->flashdata('error_message'));
	}

	/**
	 * index function, show jquery grid
	 *
	 * @access public
	 * @param null
	 * @return void
	 */

	public function index(){
		//dashboard
		$obj = new Statistics_model();
		$view = new stdClass();
		$obj->build_view($view);
		//     	print_r($this->session->all_userdata());
		//     	exit;
		//     	exit("hi");
		$this->smarty->assign("view", $view);
		$this->smarty->assign("statistics_model", $obj);
		$this->smarty->view('backend/statistics/dashboard', 'main_content');
		$this->smarty->display('template/backend/admin');
	}

	public function clicks() {
		$this->get_content();
		$this->smarty->view('backend/statistics/clicks', 'main_content');
		$this->smarty->display('template/backend/admin');
		 
		 
	}
	function read_file($source){
		$filename = './data/text/statistics/' . $source . '.txt';
		if (file_exists($filename)) {
			$content = read_file($filename);
		} else {
			$content = $source . '|' . '0|0';
		}
		return $list = explode("|", $content);

	}

	function get_content(){
		$register = array(

				'0' => $this->read_file('4vn'),
				'1' => $this->read_file('diendangosu'),
				'2' => $this->read_file('face2'),
				'3' => $this->read_file('facebookone'),
				'4' => $this->read_file('facec1'),
				'5' => $this->read_file('facec2'),
				'6' => $this->read_file('facec3'),
				'7' => $this->read_file('game4v.vn'),
				'8' => $this->read_file('gamek'),
				'9' => $this->read_file('gamek.vn'),
				'10' => $this->read_file('gamevn.com'),
				'11' => $this->read_file('gamevui.com'),
				'12' => $this->read_file('gamevui'),
				'13' => $this->read_file('gdisplay'),
				'14' => $this->read_file('gdisplaytieudao.ahha.vn'),
				'15' => $this->read_file('google'),
				'16' => $this->read_file('google120600'),
				'17' => $this->read_file('google300250'),
				'18' => $this->read_file('google72890'),
				'19' => $this->read_file('googlesearch'),
				'20' => $this->read_file('gosu'),
				'21' => $this->read_file('haivl.com'),
				'22' => $this->read_file('haivl'),
				'23' => $this->read_file('luyengame'),
				'24' => $this->read_file('manga24h.com'),
				'25' => $this->read_file('nega'),
				'26' => $this->read_file('nega.vn'),
				'27' => $this->read_file('nhaccuatui'),
				'28' => $this->read_file('nhincuoi'),
				'29' => $this->read_file('sitename'),
				'30' => $this->read_file('tamzinner'),
				'31' => $this->read_file('tamzinne'),
				'32' => $this->read_file('trochoivui.com'),
				'33' => $this->read_file('truyen.hixx.info'),
				'34' => $this->read_file('vn-zoom.com'),
				'35' => $this->read_file('voz'),

		);


		$this->smarty->assign('register', $register);

	}
}

/* End of file menu.php */
/* Location: ./system/application/controllers/backend/statistics.php */